* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 20px;
    color: #343a40;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 36px;
    color: #ff6b6b;
}

.logo h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b6b 0%, #3a86ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.controls {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.btn-primary {
    background: #ff9a9e;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 154, 158, 0.5);
}

.search-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    position: relative;
}

.search-header {
    margin-bottom: 20px;
}

.search-header h2 {
    color: #495057;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-group label {
    margin-bottom: 8px;
    color: #6c757d;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-control {
    padding: 14px 46px 14px 20px;
    /* 右侧增加内边距给按钮留空间 */
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: #3a86ff;
    box-shadow: 0 0 0 4px rgba(58, 134, 255, 0.2);
}

/* 修复清空按钮位置 */
.clear-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    /* 垂直居中 */
    transform: translateY(-50%);
    /* 精确居中 */
    color: #adb5bd;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    background: none;
    border: none;
    display: none;
    /* 默认隐藏 */
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.clear-btn:hover {
    background: #f1f3f5;
    color: #e63946;
    transform: translateY(-50%) scale(1.1);
}

.clear-btn.visible {
    display: flex;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 30px;
}

.card-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    color: #495057;
    font-size: 22px;
    font-weight: 600;
}

.card-body {
    padding: 0;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 16px 20px;
    text-align: left;
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
}

tr:hover {
    background-color: #f8f9fa;
}

.dish-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.category-tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.category-hot {
    background: #fff0f3;
    color: #e63946;
    border: 1px solid #ffccd5;
}

.category-cold {
    background: #e7f5ff;
    color: #1a759f;
    border: 1px solid #caf0f8;
}

.category-staple {
    background: #e8f5e9;
    color: #2d6a4f;
    border: 1px solid #c7f9cc;
}

.category-soup {
    background: #fff9db;
    color: #e67700;
    border: 1px solid #ffec99;
}

.category-other {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #e9ecef;
}

.price {
    font-weight: 700;
    color: #e63946;
}

.actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 16px;
}

.action-btn:hover {
    transform: scale(1.1);
}

.edit-btn {
    background: #e0f2fe;
    color: #0ea5e9;
}

.delete-btn {
    background: #fee2e2;
    color: #ef4444;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalAppear 0.4s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #495057;
    font-size: 24px;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #e63946;
}

.modal-body {
    padding: 25px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.image-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
}

.image-upload:hover {
    border-color: #3a86ff;
    background: #e7f5ff;
}

.image-upload i {
    font-size: 48px;
    color: #adb5bd;
    margin-bottom: 15px;
}

.image-upload p {
    color: #6c757d;
    text-align: center;
}

.image-preview {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 10px;
    display: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

footer {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
    margin-top: 30px;
}

.no-results {
    padding: 40px;
    text-align: center;
    color: #6c757d;
}

.no-results i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #adb5bd;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .controls {
        width: 100%;
        justify-content: center;
    }

    .card-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    th,
    td {
        padding: 12px 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    max-width: 600px;
    width: 95%;
    margin: 1rem auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
}

/* 图片上传区域 */
.image-upload {
    padding: 1rem;
    min-height: 120px;
    border: 2px dashed #ddd;
    text-align: center;
    cursor: pointer;
}

.image-preview {
    max-height: 100px;
    margin-top: 0.5rem;
    object-fit: contain;
}

/* 底部按钮 */
.form-footer {
    padding: 1rem;
    margin-top: 0.5rem;
    text-align: right;
    border-top: 1px solid #eee;
}

.btn {
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* 添加分类列表样式 */
.category-list {
    position: absolute;
    top: 100%;      /* 从顶部对齐改为从底部开始 */
    margin-top: 4px; /* 增加与输入框的间距 */
    width: calc(100% - 2px);
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.category-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.category-item:hover {
    background: #f5f5f5;
}

